
import { config } from '@/utils/config';

export const upload = (filePath: string) => new Promise(resolve => {
	const user = uni.getStorageSync('user');
	const json = {
		url: config.apiBaseUrl + '/infra/file/upload',
		filePath,
		name: 'file',
		header: {
			'tenant-id': config["tenant-id"],
			Authorization: `Bearer ${JSON.parse(user).accessToken}`
		},
		success: (res) => {
			resolve(JSON.parse(res.data));
		}
	};
	uni.uploadFile(json);
})